From: Felix Yan Date: Fri, 2 Aug 2024 09:02:12 +0000 (+0300) Subject: Enable python binding X-Git-Tag: archive/raspbian/1.1.9+ds1-4+rpi1^2^2~21 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com///%22http:/www.example.com/cgi/%22https:/www.github.com/?a=commitdiff_plain;h=badb266ed134e4ed6cdb3155dfdf2c38482fedb5;p=opencc.git Enable python binding Co-authored-by: Shengjing Zhu --- diff --git a/debian/control b/debian/control index b0a3784..aff8d50 100644 --- a/debian/control +++ b/debian/control @@ -10,9 +10,11 @@ Uploaders: xiao sheng wen , Boyuan Yang , Build-Depends: + chrpath, cmake, darts, debhelper-compat (= 13), + dh-python, doxygen , googletest , libmarisa-dev, @@ -20,8 +22,10 @@ Build-Depends: opencc , dh-sequence-pkgkde-symbolshelper, pybind11-dev, - python3:any, + python3-dev, rapidjson-dev, + python3-setuptools, + python3-wheel, Standards-Version: 4.6.2 Rules-Requires-Root: no Section: libs @@ -100,3 +104,16 @@ Description: simplified-traditional Chinese conversion tool simplified Chinese. . This package includes the conversion tool. + +Package: python3-opencc +Section: python +Architecture: any +Depends: + ${misc:Depends}, + ${python3:Depends}, + ${shlibs:Depends}, +Description: simplified-traditional Chinese conversion library - Python 3.x + opencc is a library for converting character between traditional Chinese and + simplified Chinese. + . + This package provides the Python 3.x module. diff --git a/debian/python3-opencc.install b/debian/python3-opencc.install new file mode 100644 index 0000000..4606faa --- /dev/null +++ b/debian/python3-opencc.install @@ -0,0 +1 @@ +usr/lib/python3* diff --git a/debian/rules b/debian/rules index 2dd7d65..26baabe 100755 --- a/debian/rules +++ b/debian/rules @@ -11,12 +11,13 @@ include /usr/share/dpkg/architecture.mk # Disable parallel build to circumvent some random build error # (needs further investigation) %: - dh $@ --buildsystem=cmake --no-parallel + dh $@ --with python3 --buildsystem=cmake --no-parallel BUILD_OPTIONS = \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/ \ -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_PYTHON=ON \ -DUSE_SYSTEM_DARTS=ON \ -DUSE_SYSTEM_GTEST=ON \ -DUSE_SYSTEM_MARISA=ON \ @@ -39,6 +40,21 @@ endif override_dh_auto_configure: dh_auto_configure -- $(BUILD_OPTIONS) +execute_after_dh_auto_build: + dh_auto_build -O--buildsystem=pybuild -- -s distutils --after-build \ + "cp obj-$(DEB_BUILD_GNU_TYPE)/opencc_clib.*.so {build_dir}/opencc/clib/" + +execute_after_dh_auto_test: + dh_auto_test -O--buildsystem=pybuild -- -s distutils + +execute_after_dh_auto_install: + dh_auto_install -O--buildsystem=pybuild -- -s distutils + chrpath --delete debian/tmp/usr/lib/*/dist-packages/opencc/clib/*.so + for i in debian/tmp/usr/lib/*/dist-packages/opencc/clib/; do \ + mkdir -p $$i/share/; \ + ln -sf ../../../../../../share/opencc $$i/share/; \ + done + execute_after_dh_auto_clean: find . -name *.pyc -delete